package net.seabookchen.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class ErrorController {
	private static final String SC_UNAUTHORIZED = String.valueOf(HttpServletResponse.SC_UNAUTHORIZED);

	public String handle401(HttpServletRequest request, HttpServletResponse resp, @PathVariable String code) {
		if (SC_UNAUTHORIZED.equals(code)) {
			return "unauthorized";
		}
		
		return request.getRequestURI();
	}
}
